{% extends "base.html" %}

{% block header%}
<title>用户资料编辑</title>
{% endblock %}

{% block content %}
{% with model_name='Admin' url_prefix='/system/admin/admin_' %}
<div class="bar">
	<a href="{{url_prefix}}list">用户管理</a> -> 用户资料编辑
	<div class="buttons">
		<a  class="btn btn-app btn-grey btn-xs radius-4 pull-right submit"  />保存</a>
	</div>
</div>

<form action="{{url_prefix}}save?id={{model.id}}" method="post">
	<table class="form2">
	<tr>
		<th>别名：</th><td><input type="text" name="alias" value="{{model.alias}}" /></td>
	</tr>
	<tr>
		<th>登录名：</th><td><input type="text" {%if model.id%} readonly=readonly {%endif%}name="username" value="{{model.username}}" /></td>

	</tr>
	<tr>
		<th>密码：</th><td><input type="password" name="password" value="{{model.password}}" /></td>
	</tr>
	{% with model.role.all as roles%}
    {% if request.admin.is_root and  not not_is_root %}
	<tr>
		<th>管理员角色:</th>
		<td>
		
			{% for r in request.admin.resource.role%}
			{% if not r.type%}
			<label ><input type="checkbox" name="role_id" value="{{r.id}}" {%if r in  roles %}checked="checked"{%endif%}>{{r.name}}</label>
			{%endif%}
			{%endfor%}
		</td>
    {% endif %}
	<tr>
		<th>普通角色:</th>
		<td>
		
			{% for r in request.admin.resource.role%}
			{% if  r.type%}
			<label ><input type="checkbox" name="role_id" value="{{r.id}}" {%if r in  roles %}checked="checked"{%endif%}>{{r.name}}</label>
			{%endif%}
			{%endfor%}
		</td>
	</tr>
	{%endwith%}

	<th></th><td></td>
</tr>
</table>
</form>
{% endwith %}
{% endblock %}